import { BaseWindow } from "../../../../component/window/BaseWindow";
import { Language } from "../../../../../extend/language/Language";
import { GButton } from "../../../../../com/mui/controls/GButton";
import { ObjCreate } from "../../common/ObjCreate";
import { GTextFormat } from "../../../../common/GTextFormat";
import { EffectManager } from "../../../manager/EffectManager";
import { MaskInfo } from "../../effect/MaskInfo";
import { GuideTipsManager } from "../../../manager/GuideTipsManager";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
//class AutoUpdateResultPanel
    
    export  class AutoUpdateResultPanel extends BaseWindow
    {
        constructor()
        {
            super();
            this.setSize(280, 200);
            this.titleHeight = 24;
            this.title = Language.getString(60310);
            return;
        }

        public get btnOK(): GButton
        {
            return this._btnOK;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(13, 35, 250, 118, this);
            this._resultText = new Object /* flash.text.TextField */();
            this._resultText.x = 32;
            this._resultText.y = 42;
            this._resultText.width = 225;
            this._resultText.height = 120;
            this._resultText.wordWrap = true;
            this.addChild(this._resultText);
            this._btnOK = ObjCreate.createGButton(Language.getString(69901), 100, 165, 80, 26, this);
            this._btnOK.addEventListener(flash.events.MouseEvent.CLICK, this.onCloseHandler);
            return;
        }

        public setResultText(arg1: string, arg2: string): void
        {
            this.title = arg2;
            this._resultText.htmlText = arg1;
            var loc1=new GTextFormat();
            loc1.leading = 5;
            loc1.color = 11661311;
            this._resultText.setTextFormat(loc1);
            return;
        }

        public guideEquipReq(): void
        {
            var loc2=null;
            EffectManager.hideUIMask();
            var loc1=new MaskInfo();
            loc1.x = this.x + this._btnOK.x;
            loc1.y = this.y + this._btnOK.y;
            loc1.width = this._btnOK.width;
            loc1.height = this._btnOK.height;
            EffectManager.addUIMask([loc1]);
            loc2 = GuideTipsManager.getGuideTips(GuideTipsManager.Dir_TR, Language.getString(60311));
            loc2.x = this._btnOK.x;
            loc2.y = this._btnOK.y + this._btnOK.height / 2;
            $addChild(loc2);
            return;
        }

        /* internal  */guideHide(): void
        {
            if (GuideTipsManager.guideTips.parent == this) 
            {
                GuideTipsManager.hideGuideTips();
                EffectManager.hideUIMask();
                Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_EquipeResult));
            }
            return;
        }

        /* internal  */onCloseHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        protected /* override */ updateSize(): void
        {
            super.updateSize();
            _windowCenter.height = 128;
            return;
        }

        public /* override */ hide(): void
        {
            this.guideHide();
            super.hide();
            return;
        }

        /* internal */ /* var */_btnOK: GButton;

        /* internal */ /* var */_resultText: Object /* flash.text.TextField */;
    }
